# encoding: utf-8
"""
@author: yangwei
@contact: yangchen211@126.com
@time: 2021/8/22 3:50 下午
@file: http_api.py
@desc: 
"""
import requests
from requests import request

from service.api.log import log


class HttpAPI:
    def request(self, method, url, *args, **kwargs):
        # log.debug({
        #     'url':url,
        #     'method'=method,
        #     **kwargs
        # })
        kwargs['method'] =method
        kwargs['url']=url
        print(kwargs)
        r = requests.request(
            method=method,
            url=url,
            headers={
                'Authorization-Type': f'Bearer {self.token}'
            },
            **kwargs
        )
        print(r.status_code)
        return r.json()